<?php
   $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $starttime = $mtime;
?>
<?php

# MantisBT - a php based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.

	/**
	 * @package MantisBT
	 * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
	 * @copyright Copyright (C) 2002 - 2010  MantisBT Team - mantisbt-dev@lists.sourceforge.net
	 * @link http://www.mantisbt.org
	 */
	 /**
	  * MantisBT Core API's
	  */
	require_once( 'core.php' );

	require_once( 'summary_api.php' );

	$f_project_id = gpc_get_int( 'project_id', helper_get_current_project() );

	# Override the current page to make sure we get the appropriate project-specific configuration
	$g_project_override = $f_project_id;

	access_ensure_project_level( config_get( 'view_summary_threshold' ) );

	$t_user_id = auth_get_current_user_id();

	$t_project_ids = user_get_all_accessible_projects( $t_user_id, $f_project_id);
	$specific_where = helper_project_specific_where( $f_project_id, $t_user_id);

	$t_bug_table = db_get_table( 'mantis_bug_table' );
	$t_history_table = db_get_table( 'mantis_bug_history_table' );

	$t_resolved = config_get( 'bug_resolved_status_threshold' );
	# the issue may have passed through the status we consider resolved
	#  (e.g., bug is CLOSED, not RESOLVED). The linkage to the history field
	#  will look up the most recent 'resolved' status change and return it as well
	$query = "SELECT b.id, b.date_submitted, b.last_updated, MAX(h.date_modified) as hist_update, b.status
        FROM $t_bug_table b LEFT JOIN $t_history_table h
            ON b.id = h.bug_id  AND h.type=0 AND h.field_name='status' AND h.new_value=" . db_param() . "
            WHERE b.status >=" . db_param() . " AND $specific_where
            GROUP BY b.id, b.status, b.date_submitted, b.last_updated
            ORDER BY b.id ASC";
	$result = db_query_bound( $query, Array( $t_resolved, $t_resolved ) );
	$bug_count = db_num_rows( $result );

	$t_bug_id       = 0;
	$t_largest_diff = 0;
	$t_total_time   = 0;
	for ($i=0;$i<$bug_count;$i++) {
		$row = db_fetch_array( $result );
		$t_date_submitted = $row['date_submitted'];
		$t_id = $row['id'];
		$t_status = $row['status'];
		if ( $row['hist_update'] !== NULL ) {
            $t_last_updated   = $row['hist_update'];
        } else {
        	$t_last_updated   = $row['last_updated'];
        }

		if ($t_last_updated < $t_date_submitted) {
			$t_last_updated   = 0;
			$t_date_submitted = 0;
		}

		$t_diff = $t_last_updated - $t_date_submitted;
		$t_total_time = $t_total_time + $t_diff;
		if ( $t_diff > $t_largest_diff ) {
			$t_largest_diff = $t_diff;
			$t_bug_id = $row['id'];
		}
	}
	if ( $bug_count < 1 ) {
		$bug_count = 1;
	}
	$t_average_time 	= $t_total_time / $bug_count;

	$t_largest_diff 	= number_format( $t_largest_diff / SECONDS_PER_DAY, 2 );
	$t_total_time		= number_format( $t_total_time / SECONDS_PER_DAY, 2 );
	$t_average_time 	= number_format( $t_average_time / SECONDS_PER_DAY, 2 );

	$t_orct_arr = preg_split( '/[\)\/\(]/', lang_get( 'orct' ), -1, PREG_SPLIT_NO_EMPTY );

	$t_orcttab = "";
	foreach ( $t_orct_arr as $t_orct_s ) {
		$t_orcttab .= '<td class="right">';
		$t_orcttab .= $t_orct_s;
		$t_orcttab .= '</td>';
	}

	html_page_top( lang_get( 'summary_link' ) );
?>

<br />
<?php
$t_current_user_name = current_user_get_field( 'username' );

//Function Counting time query
function Query_time ($displ = false) 
{
	$qt = 0;$qn = 0;
	$sql_time = QueryResultsAsArray("SHOW profiles");
	foreach ($sql_time as $o) {
	$qt = number_format($o->Duration + $qt,6,'.',' ');
	$qn++;
	}
	if ($displ == false)
	return $qt;
	else echo "$qn Querys&nbsp;in&nbsp;".$qt."&nbsp;sec.";
	return ;
}


echo "<table border=1 cellpadding=0 cellspacing=0 style='border-collapse:collapse' width=100%>
<tr><td align=center>DATA CENTER - Trung tâm Dịch vụ khách hàng</td></tr>
<tr><td align=center>";
//Bang số liệu hàng tháng
echo "
<div style='background-color:#CCCCCC;margin-bottom:5px;'><b>Monthly customer request</b></div>
<table border=1 style='border: 1px solid black; float: left; width: 5%; border-collapse:collapse;'>
	<tr><td class=monthly1><b>Monthly</td></tr>
	<tr><td class=monthly1 height=60><b>pTOTAL</td></tr>
	<tr><td class=monthly2><b>Đại lí</td></tr>
	<tr><td class=monthly2><b>Cá nhân</td></tr>
</table>";
$t_today = date("d");
$t_month = date("m");
$t_month1 = date("F - Y");
$t_year	 = date("Y");
$t_hour	 = date("H");

for ($i=1;$i<=$t_month;$i++)
{
	$sDaily =mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')='$i' and from_unixtime(start_time, '%Y')='$t_year' and dt='agent'");
	$sCanhan =mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')='$i' and from_unixtime(start_time, '%Y')='$t_year' and dt='user'");
	$pTotal =mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')='$i' and from_unixtime(start_time, '%Y')='$t_year'");
	$sYear  =mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%Y')='$t_year'");		
	
	echo "<table border=1 style='float:left;border-collapse:collapse;'>
			<tr><td class=monthly>".$i."-".$t_year."</td></tr><tr>";
			while ($row = mysql_fetch_array($pTotal))
			{  $height = round($row['count(name)']/15);
					echo "<td class=monthly valign=bottom height=60 align=center>".$row['count(name)']."
					<table width=100% cellpadding=0 cellspacing=0 style='border-collapse:collapse'>
					<tr><td class=monthly height=".$height." bgcolor=#032D8D></td></tr></table>
					</td>";
			}			
			echo "</tr>
			<tr><td class=monthly2>";while ($row = mysql_fetch_array($sDaily)){echo $row['count(name)'];}echo "</td></tr>
			<tr><td class=monthly2>";while ($row = mysql_fetch_array($sCanhan)){echo $row['count(name)'];}echo "</td></tr>
			</table>";
}
$t2012 =mysql_query("Select count(id) from mantis_care_report_table where from_unixtime(start_time, '%Y')=2012");
while ($row = mysql_fetch_array($t2012)) 
		{ echo "<br><br><br><br><br><br><br><br>
		<div> <img src='images/chart.png'> Tổng số request [2012]: ".$row['count(id)']." </div>";}


//Daily request
echo "<br>
	<div style='background-color:#CCCCCC;margin-bottom:5px;'><b>[".$t_month1."] Daily customer request </div>
	<table border=1 style='border: 1px solid black; float: left; width: 5%; height: 1em; border-collapse:collapse'>
	<tr><td class=monthly1><b>Daily<br><br></td></tr>
	<tr><td class=monthly1 height=60><b>pTOTAL</td></tr>
	<tr><td class=monthly1><b>Đại lí</td></tr>
	<tr><td class=monthly1><b>Cá nhân</td></tr>
	</table>";
	
for ($i=1;$i<=$t_today;$i++)
{
$sMon =	mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')='$t_month'");
$pTotald =mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%e')='$i' and from_unixtime(start_time,'%c')=$t_month and from_unixtime(start_time,'%Y')=$t_year");
$sDayDL =mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%e')='$i' and from_unixtime(start_time,'%c')=$t_month and dt='agent' and from_unixtime(start_time,'%Y')=$t_year");
$sDayCN =mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%e')='$i' and from_unixtime(start_time,'%c')=$t_month and dt='user' and from_unixtime(start_time,'%Y')=$t_year");

$date = $t_year."/".$t_month."/".$i;
$weekday = date('D', strtotime($date));

echo "<table border=1 style='border: 1px solid black; float: left; width: 40px; height: 1em; border-collapse:collapse'>
		<tr>";
		if ($weekday == Sun){echo "<td class=monthly bgcolor=red><b>".$i."-".$t_month."<br>".$weekday."</td>";}
		else { echo "<td class=monthly>".$i."-".$t_month."<br>".$weekday."</td>";}
		
		echo "</tr>";
		while ($row = mysql_fetch_array($pTotald))
		{  $height = round($row['count(name)']);
			echo "<td class=monthly valign=bottom height=60>".$row['count(name)']."
			<table width=100% cellpadding=0 cellspacing=0 style='border-collapse:collapse'><tr><td class=monthly height=".$height." bgcolor=#032D8D></td></tr></table>
			</td>";
		}			
			echo "</tr>
			<tr><td class=monthly>";while ($row = mysql_fetch_array($sDayDL)){echo $row['count(name)'];}echo "	</td></tr>
			<tr><td class=monthly>";while ($row = mysql_fetch_array($sDayCN)){echo $row['count(name)'];}echo "	</td></tr>
		</table>";
}

//Hourly request

echo "<br><br><br><br><br><br><br><br><br><br>
	<div style='background-color:#CCCCCC;margin-bottom:5px;'><b>Hourly customer request</b></div>
	<table border=1 style='border: 1px solid black; float: left; width: 5%; height: 1em; border-collapse:collapse'>
	<tr><td class=monthly1><b>Hourly</td></tr>
	<tr><td class=monthly1 height=80><b>pTOTAL</td></tr>
	<tr><td class=monthly1><b>Đại lí</td></tr>
	<tr><td class=monthly1><b>Cá nhân</td></tr>
	</table>";

$st3 = microtime();
for ($i=8;$i<=18;$i++)
{
$sHour = mysql_query(" select count(name) from mantis_care_report_table where from_unixtime(start_time, '%k')=$i");
$pTotald =mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%k')='$i'");
$sHourDL =mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%k')='$i' and dt='agent'");
$sHourCN =mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%k')='$i' and dt='user'");

echo "<table border=1 style='border: 1px solid black; float: left; width: 40px; height: 1em; border-collapse:collapse'>
		<tr><td class=monthly>".$i."</td></tr>
		<tr>";
			while ($row = mysql_fetch_array($pTotald))
			{  
				$height = round($row['count(name)']/70);
				echo "<td class=monthly valign=bottom height=80>".$row['count(name)']."
					<table width=100% cellpadding=0 cellspacing=0 style='border-collapse:collapse'>
					<tr><td height=".$height." bgcolor=#032D8D></td></tr></table>
					</td>";
			}
	echo "</tr>
			<tr><td class=monthly>";while ($row = mysql_fetch_array($sHourDL)){echo $row['count(name)'];}echo "</td></tr>
			<tr><td class=monthly>";while ($row = mysql_fetch_array($sHourCN)){echo $row['count(name)'];}echo "</td></tr>
	</table>";
}

//Status request

echo "<br><br><br><br><br><br><br><br><br><br>
	<div style='background-color:#CCCCCC;margin-bottom:5px;'><b>[".$t_month1."] Status request </b></div>
	<table border=1 style='border: 1px solid black; float: left; width: 15%; height: 1em; border-collapse:collapse'>
	<tr><td class=monthly1><b>Daily</td></tr>
	<tr><td class=monthly1><b>Dính virus</td></tr>
	<tr><td class=monthly1><b>Cách sử dụng sản phẩm</td></tr>
	<tr><td class=monthly1><b>Lỗi sản phẩm</td></tr>
	<tr><td class=monthly1><b>Liên quan đến bản quyền</td></tr>
	<tr><td class=monthly1><b>Sự cố máy tính</td></tr>
	<tr><td class=monthly1><b>Máy bận/notconnect/SĐT sai</td></tr>
	<tr><td class=monthly1><b>Không gặp vấn đề gì</td></tr>
	<tr><td class=monthly1><b>Các vấn đề khác</td></tr>
	</table>";

for ($i=1;$i<=$t_month;$i++)
{
$sVirus = mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')=$i and from_unixtime(start_time, '%Y')='$t_year' and status='virus'");
$sUsing = mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')=$i and from_unixtime(start_time, '%Y')='$t_year' and status='using'");
$sProductError = mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')=$i and from_unixtime(start_time, '%Y')='$t_year' and status='ProductError'");
$sLicense = mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')=$i and from_unixtime(start_time, '%Y')='$t_year' and status='License'");
$sComputerError = mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')=$i and from_unixtime(start_time, '%Y')='$t_year' and status='ComputerError'");
$sCallError = mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')=$i and from_unixtime(start_time, '%Y')='$t_year' and status='CallError'");
$snopro = mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')=$i and from_unixtime(start_time, '%Y')='$t_year' and status='nopro'");
$sOther = mysql_query("Select count(name) from mantis_care_report_table where from_unixtime(start_time, '%c')=$i and from_unixtime(start_time, '%Y')='$t_year' and status='other'");

echo "<table border=1 style='border: 1px solid black; float: left; width: 40px; height: 1em; border-collapse:collapse'>
		<tr>";echo "<td class=monthly>".$i."-".$t_year."</td>";echo "</tr>
		<tr><td class=monthly>";while ($row = mysql_fetch_array($sVirus))
		{echo "<a href='view_filters_care_page.php?do=list&time=$i&order=virus'>".$row['count(name)']."</a>";}
		echo "</td></tr>
		<tr><td class=monthly>";while ($row = mysql_fetch_array($sUsing))
		{echo "<a href='view_filters_care_page.php?do=list&time=$i&order=using'>".$row['count(name)']."</a>";}echo "</tr>
		<tr><td class=monthly>";while ($row = mysql_fetch_array($sProductError)){
		echo "<a href='view_filters_care_page.php?do=list&time=$i&order=ProductError'>".$row['count(name)']."</a>";}echo "</tr>
		<tr><td class=monthly>";while ($row = mysql_fetch_array($sLicense))
		{echo "<a href='view_filters_care_page.php?do=list&time=$i&order=License'>".$row['count(name)']."</a>";}echo "</tr>
		<tr><td class=monthly>";while ($row = mysql_fetch_array($sComputerError))
		{echo "<a href='view_filters_care_page.php?do=list&time=$i&order=ComputerError'>".$row['count(name)']."</a>";}echo "</tr>
		<tr><td class=monthly>";while ($row = mysql_fetch_array($sCallError))
		{echo "<a href='view_filters_care_page.php?do=list&time=$i&order=CallError'>".$row['count(name)']."</a>";}echo "</tr>
		<tr><td class=monthly>";while ($row = mysql_fetch_array($snopro))
		{echo "<a href='view_filters_care_page.php?do=list&time=$i&order=nopro'>".$row['count(name)']."</a>";}echo "</tr>
		<tr><td class=monthly>";while ($row = mysql_fetch_array($sOther))
		{echo "<a href='view_filters_care_page.php?do=list&time=$i&order=Other'>".$row['count(name)']."</a>";}echo "</tr>
	</table>";
}

//Phone request

/* echo "<br><br><br><br><br><br><br><br><br><br><br><br><br>
	<div style='background-color:#CCCCCC;margin-bottom:5px;'><b>Monthly Phone Request </b></div>
	<table border=1 style='border: 1px solid black; float: left; width: 13%; height: 1em; border-collapse:collapse'>
		<tr><td class=monthly4><b>Nhà cung cấp viễn thông</td></tr>
		<tr><td class=monthly4><img src='images/viettel.gif'> Viettel</td></tr>
		<tr><td class=monthly4><img src='images/mobifone.jpg'> MobiFone</td></tr>
		<tr><td class=monthly4><img src='images/vinaphone.jpg'> VinaPhone</td></tr>
		<tr><td class=monthly4><img src='images/sfone.jpg'> S-Fone</td></tr>
		<tr><td class=monthly4><img src='images/vnmobi.gif'> VietnamMobi</td></tr>
		<tr><td class=monthly4><img src='images/beeline.jpg'> Beeline</td></tr>
		<tr><td class=monthly4><img src='images/evn.jpg'> EVN</td></tr>
		<tr><td class=monthly4><img src='images/buuchinh.jpg'> Bưu Chính</td></tr>
		<tr><td class=monthly4><img  src='images/question.jpg'> Không xác định</td></tr>
		<tr><td class=monthly4><b>Total</td></tr>
	</table>";

for ($i=1;$i<=$t_month;$i++)
{
	$sVT = mysql_query("select count(phone) from mantis_care_report_table where (`phone` like '%098%' or `phone` like '%097%' or `phone` like '%0168%' or `phone` like '%0169%' or `phone` like '%0167%' or `phone` like '%0165%' or `phone` like '%0166%') and from_unixtime(start_time,'%c%')=$i  and from_unixtime(start_time, '%Y')='$t_year'");
	$sMobi = mysql_query("select count(phone) from mantis_care_report_table where (`phone` like '%090%' or `phone` like '%093%' or `phone` like '%0122%' or `phone` like '%0126%' or `phone` like '%0121%' or `phone` like '%0128%' or `phone` like '%0120%') and from_unixtime(start_time,'%c%')=$i and from_unixtime(start_time, '%Y')='$t_year'");
	$sVina = mysql_query("select count(phone) from mantis_care_report_table where (`phone` like '%091%' or `phone` like '%094%' or `phone` like '%0123%' or `phone` like '%0125%' or `phone` like '%0127%') and from_unixtime(start_time,'%c%')=$i and from_unixtime(start_time, '%Y')='$t_year'");
	$sSPhone = mysql_query("select count(phone) from mantis_care_report_table where `phone` like '%095%' and from_unixtime(start_time,'%c%')=$i and from_unixtime(start_time, '%Y')='$t_year'");
	$sVNmobi = mysql_query("select count(phone) from mantis_care_report_table where `phone` like '%092%' and from_unixtime(start_time,'%c%')=$i and from_unixtime(start_time, '%Y')='$t_year'");
	$sBeeline= mysql_query("select count(phone) from mantis_care_report_table where `phone` like '%0199%' and from_unixtime(start_time,'%c%')=$i and from_unixtime(start_time, '%Y')='$t_year'");
	$sEVN= mysql_query("select count(phone) from mantis_care_report_table where `phone` like '%096%' and from_unixtime(start_time,'%c%')=$i and from_unixtime(start_time, '%Y')='$t_year'");
	$sNotPhone= mysql_query("select count(phone) from mantis_care_report_table where `phone` like '% %' and from_unixtime(start_time,'%c%')=$i and from_unixtime(start_time, '%Y')='$t_year'");
	$sBuudien= mysql_query("select count(phone) from mantis_care_report_table where `phone` not like '%098%' and `phone` not like '%097%' and `phone` not like '%0168%' and `phone` not like '%0169%' and `phone` not like '%0167%' and `phone` not like '%0165%' and `phone` not like '%0166%' and `phone` not like '%090%' and `phone` not like '%093%' and `phone` not like '%0122%' and `phone` not like '%0126%' and `phone` not like '%0121%' and `phone` not like '%0128%' and `phone` not like '%0120%' and `phone` not like '%091%' and `phone` not like '%094%' and `phone` not like '%0123%' and `phone` not like '%0125%' and `phone` not like '%0127%' and `phone` not like '%095%' and `phone` not like '%092%' and `phone` not like '%0199%' and `phone` not like '%096%' and `phone` not like '' and from_unixtime(start_time,'%c%')=$i and from_unixtime(start_time, '%Y')='$t_year'");
	$spTotal= mysql_query("select count(id) from mantis_care_report_table where from_unixtime(start_time,'%c%')=$i and from_unixtime(start_time, '%Y')='$t_year'");
	
	echo "<table border=1 style='border: 1px solid black; float: left; width: 40px; height: 1em; border-collapse:collapse'>
		<tr><td class=monthly4>".$i."-".$t_year."</td></tr>
		<tr><td class=monthly4>";while ($row = mysql_fetch_array($sVT)){echo $row['count(phone)'];}echo "</td></tr>
		<tr><td class=monthly4>";while ($row = mysql_fetch_array($sMobi)){echo $row['count(phone)'];}echo "</td></tr>
		<tr><td class=monthly4>";while ($row = mysql_fetch_array($sVina)){echo $row['count(phone)'];}echo "</td></tr>
		<tr><td class=monthly4>";while ($row = mysql_fetch_array($sSPhone)){echo $row['count(phone)'];}echo "</td></tr>
		<tr><td class=monthly4>";while ($row = mysql_fetch_array($sVNmobi)){echo $row['count(phone)'];}echo "</td></tr>
		<tr><td class=monthly4>";while ($row = mysql_fetch_array($sBeeline)){echo $row['count(phone)'];}echo "</td></tr>
		<tr><td class=monthly4>";while ($row = mysql_fetch_array($sEVN)){echo $row['count(phone)'];}echo "</td></tr>
		<tr><td class=monthly4>";while ($row = mysql_fetch_array($sBuudien)){echo $row['count(phone)'];}echo "</td></tr>
		<tr><td class=monthly4>";while ($row = mysql_fetch_array($sNotPhone)){echo $row['count(phone)'];}echo "</td></tr>
		<tr><td class=monthly4>";while ($row = mysql_fetch_array($spTotal)){echo $row['count(id)'];}echo "</td></tr></table>";
}	
*/
	//Agent request
echo "<br><br><br><br><br><br><br><br><br><br><br><br>";
?>

<!-- put this code at the bottom of the page -->
<?php
   /* $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $endtime = $mtime;
   $totaltime = ($endtime - $starttime);
   echo "This page was created in ".$totaltime." seconds"; */
?>
<?php 
/* <table class="width100" cellspacing="1">
<tr>
	<td class="form-title" colspan="2">
		<?php echo lang_get( 'summary_title' ) ?>
	</td>
</tr>
<tr valign="top">
	<td width="50%">
		<?php # PROJECT # 
			if ( 1 < count( $t_project_ids ) ) { ?>
		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'by_project' ) ?>
			</td>
			<?php echo $t_orcttab ?>
		</tr>
		<?php summary_print_by_project(); ?>
		</table>

		<br />
		<?php } ?>

		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'by_status' ) ?>
			</td>
			<?php echo $t_orcttab ?>
		</tr>
		<?php summary_print_by_enum( 'status' ) ?>
		</table>

		<br />

		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'by_severity' ) ?>
			</td>
			<?php echo $t_orcttab ?>
		</tr>
		<?php summary_print_by_enum( 'severity' ) ?>
		</table>

		<br />

		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'by_category' ) ?>
			</td>
			<?php echo $t_orcttab ?>
		</tr>
		<?php summary_print_by_category() ?>
		</table>

		<br />

		<table class="width100">
		<tr>
			<td class="form-title" colspan="5">
				<?php echo lang_get( 'time_stats' ) ?>
			</td>
		</tr>
		<tr class="row-1">
			<td width="50%">
				<?php echo lang_get( 'longest_open_bug' ) ?>
			</td>
			<td width="50%">
				<?php
					if ($t_bug_id>0) {
						print_bug_link( $t_bug_id );
					}
				?>
			</td>
		</tr>
		<tr class="row-2">
			<td>
				<?php echo lang_get( 'longest_open' ) ?>
			</td>
			<td>
				<?php echo $t_largest_diff ?>
			</td>
		</tr>
		<tr class="row-1">
			<td>
				<?php echo lang_get( 'average_time' ) ?>
			</td>
			<td>
				<?php echo $t_average_time ?>
			</td>
		</tr>
		<tr class="row-2">
			<td>
				<?php echo lang_get( 'total_time' ) ?>
			</td>
			<td>
				<?php echo $t_total_time ?>
			</td>
		</tr>
		</table>

		<br />

		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'developer_stats' ) ?>
			</td>
			<?php echo $t_orcttab ?>
		</tr>
		<?php summary_print_by_developer() ?>
		</table>
	</td>



	<td width="50%">
		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title"><?php echo lang_get( 'by_date' ); ?></td>
			<td class="right"><?php echo lang_get( 'opened' ); ?></td>
			<td class="right"><?php echo lang_get( 'resolved' ); ?></td>
			<td class="right"><?php echo lang_get( 'balance' ); ?></td>
		</tr>
		<?php summary_print_by_date( config_get( 'date_partitions' ) ) ?>
		</table>

		<br />

		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" width="86%"><?php echo lang_get( 'most_active' ); ?></td>
			<td class="right" width="14%"><?php echo lang_get( 'score' ); ?></td>
		</tr>
		<?php summary_print_by_activity() ?>
		</table>

		<br />

		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" width="86%"><?php echo lang_get( 'longest_open' ); ?></td>
			<td class="right" width="14%"><?php echo lang_get( 'days' ); ?></td>
		</tr>
		<?php summary_print_by_age() ?>
		</table>

		<br />

		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'by_resolution' ) ?>
			</td>
			<?php echo $t_orcttab ?>
		</tr>
		<?php summary_print_by_enum( 'resolution' ) ?>
		</table>

		<br />

		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'by_priority' ) ?>
			</td>
			<?php echo $t_orcttab ?>
		</tr>
		<?php summary_print_by_enum( 'priority' ) ?>
		</table>

		<br />

		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'reporter_stats' ) ?>
			</td>
			<?php echo $t_orcttab ?>
		</tr>
		<?php summary_print_by_reporter() ?>
		</table>

		<br />

		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'reporter_effectiveness' ) ?>
			</td>
			<td>
				<?php echo lang_get( 'severity' ) ?>
			</td>
			<td>
				<?php echo lang_get( 'errors' ) ?>
			</td>
			<td>
				<?php echo lang_get( 'total' ) ?>
			</td>
		</tr>
		<?php summary_print_reporter_effectiveness( config_get( 'severity_enum_string' ), config_get( 'resolution_enum_string' ) ) ?>
		</table>
	</td>
</tr>

<tr valign="top">
	<td colspan="2">
		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'reporter_by_resolution' ) ?>
			</td>
			<?php
			$t_resolutions = MantisEnum::getValues( config_get( 'resolution_enum_string' ) );

			foreach ( $t_resolutions as $t_resolution ) {
				echo '<td>', get_enum_element( 'resolution', $t_resolution ), '</td>';
			}

			echo '<td>', lang_get( 'percentage_errors' ), '</td>';
			?>
		</tr>
		<?php summary_print_reporter_resolution( config_get( 'resolution_enum_string' ) ) ?>
		</table>
	</td>
</tr>

<tr valign="top">
	<td colspan="2">
		<table class="width100" cellspacing="1">
		<tr>
			<td class="form-title" colspan="1">
				<?php echo lang_get( 'developer_by_resolution' ) ?>
			</td>
			<?php
			$t_resolutions = MantisEnum::getValues( config_get( 'resolution_enum_string' ) );

			foreach ( $t_resolutions as $t_resolution ) {
				echo '<td>', get_enum_element( 'resolution', $t_resolution ), '</td>';
			}

			echo '<td>', lang_get( 'percentage_fixed' ), '</td>';
			?>
		</tr>
		<?php summary_print_developer_resolution( config_get( 'resolution_enum_string' ) ) ?>
		</table>
	</td>
</tr>
</table> */
?>
<?php
	html_page_bottom();
